package com.xhwl.logistics.service.cent;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xhwl.common.dto.cent.device.DeviceDTO;
import com.xhwl.common.pojo.ResultJson;
import com.xhwl.common.pojo.cent.device.Device;
import com.xhwl.common.pojo.cent.device.DeviceProduct;
import com.xhwl.common.query.cent.device.DevicePageQuery;
import com.xhwl.common.query.cent.device.DeviceQuery;
import feign.Param;
import feign.RequestLine;
import org.springframework.cloud.openfeign.FeignClient;

import java.util.List;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author Lin.Yang
 * @since 2021-04-06
 */
@FeignClient(value = "cent-device")
public interface IDeviceService  {

    @RequestLine(value = "POST /device-service/update")
    ResultJson update(@Param("industryId") Short industryId, @Param("deviceDTO") DeviceDTO deviceDTO);

    @RequestLine(value = "POST /device-service/list")
    List<DeviceDTO> list(@Param("industryId") Short industryId, @Param("deviceQuery") DeviceQuery deviceQuery);

    @RequestLine(value = "POST /device-service/list-with-product")
    List<DeviceDTO> listWithProduct(@Param("industryId") Short industryId, @Param("deviceQuery") DeviceQuery deviceQuery);

    @RequestLine(value = "POST /device-service/page-device")
    Page<DeviceDTO> listPageDevice(@Param("industryId") Short industryId, @Param("devicePageQuery") DevicePageQuery devicePageQuery);

    @RequestLine(value = "POST /device-service/list-device")
    List<DeviceDTO> listDevice(@Param("industryId") Short industryId, @Param("devicePageQuery") DevicePageQuery devicePageQuery);
    /**
     * 批量修改设备
     *
     * @param industryId 业态 id
     * @param dtos       设备
     * @return 修改结果
     */
    @RequestLine(value = "POST /device-service/batchupdate")
    ResultJson batchUpdate(@Param("industryId") Short industryId,
                           @Param("dtos") List<DeviceDTO> dtos);

    @RequestLine(value = "POST /device-service/batch-save")
    ResultJson batchSave(@Param("industryId") Short industryId,
                         @Param("devices") List<Device> devices);

    /**
     * 批量删除设备
     */
    @RequestLine(value = "POST /device-service/batch-delete")
    ResultJson BatchDelete(@Param("industryId") Short industryId,
                           @Param("devices") List<Device> devices);

    @RequestLine(value = "POST /device-service/async-update-onlinestatus")
    void asyncUpdateOnlineStatus(@Param("deviceList") List<Device> deviceList);

    //device中台的feign接口，查询产品信息
    @RequestLine(value = "GET /product-feign/list")
    List<DeviceProduct> list();

    @RequestLine(value = "POST /device-service/async-update-device")
    ResultJson asyncUpdateDevice(@Param("deviceDTOList") List<DeviceDTO> deviceDTOList);
}
